package com.my.study.collections.ergodic;

import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author: yidujun
 * @create: 2021/03/23 17:21
 */
@Slf4j
public class MapTest {

    private LinkedHashMap<String, Integer> map = new LinkedHashMap<>();
    private String letters[] = { "a", "b", "c", "d", "e" };

    @Before
    public void init() {
        for (int i = 0; i < letters.length; i++) {
            map.put(letters[i], i + 1);
        }
    }

    @Test
    public void test() {
        Integer head = ErgodicMapUtils.getHeadByIterator(map).getValue();
        Integer tail = ErgodicMapUtils.getTailByIterator(map).getValue();
        System.out.println(head + "\t" + tail);

        Integer head1 = ErgodicMapUtils.getHeadByReflect(map).getValue();
        Integer tail1 = ErgodicMapUtils.getTailByReflect(map).getValue();
        System.out.println(head1 + "\t" + tail1);

    }



}
